package HomeWorkNewYear;

import java.util.Random;

public class Day05MethodDemo2 {
    public static void main(String[] args) {
        int b = sum (5,6);
        System.out.println(b);
        int m=5,n=6;
        int c = sum(m,n);
        System.out.println(c);

        int[]d= generateArray(5,100);
        System.out.println("数组的长度为:"+d.length);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int []e= generateArray(8,20);
        System.out.println("第一个元素的值:"+e[0]);
        for (int i=0;i<e.length;i++){
            System.out.println(e[i]);
        }
    }
    public static int[]generateArray(int len,int max){
        Random rand = new Random();
        int[] arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=rand.nextInt(max+1);
        }
        return arr;
    }
    public static int sum(int num1,int num2){
        int num=num1+num2;
        return num;
    }
}


